#!/bin/bash

set -e

# Check version in https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-init/
# Search "Running kubeadm without an internet connection"
# For running kubeadm without an internet connection you have to pre-pull the required master images for the version of choice:
gate_VERSION=1.2.0-20181016042808
deck_VERSION=2.5.0-20181012042808
front50_PAUSE_VERSION=0.13.0-20181005212906
clouddriver_VERSION=4.0.0-20181005152808
echo_VERSION=2.1.0-20181003100130
orca_VERSION=1.1.0-20181003100130
igor_VERSION=0.13.0-20181003100130
rosco_VERSION=0.8.0-20181003100130
GCR_URL=gcr.io/spinnaker-marketplace
ALIYUN_URL=registry.cn-hongkong.aliyuncs.com/jml

# When test v1.11.0, I found Kubernetes depends on both pause-amd64:3.1 and pause:3.1

images=(gate:${gate_VERSION}
deck:${deck_VERSION}
front50:${front50_PAUSE_VERSION}
clouddriver:${clouddriver_VERSION}
echo:${echo_VERSION}
orca:${orca_VERSION}
igor:${igor_VERSION}
rosco:${rosco_VERSION})


for imageName in ${images[@]} ; do
  docker pull $ALIYUN_URL/$imageName
  docker tag  $ALIYUN_URL/$imageName $GCR_URL/$imageName
  docker rmi $ALIYUN_URL/$imageName
done

docker images


